

*** Figure 1 ***

clear

*Set the folder where data are
cd ""

use B2_correct,clear

*drop HH and workers observed only once
drop if honeobsfyr==1
drop if wnyrsp==1

bysort dhcode year: gen counter = _n == 1   // create a dummy variable 1 for first HH obs in a year, 0 otherwise
by dhcode: replace counter = sum(counter)     // sum the 1s and 0s only within HH, hence the first year that first member in HH is observed is 1, the second year is 2 etc
by dhcode: egen hhnyrsp = max(counter)     //  within HH replaces all values with the highest to give the HH number of years in the UHS
label var hhnyrsp "HH total number of years in UHS panel"
tab hhnyrsp 
drop if hhnyrsp==1


drop if hMWshare==.

*** Figure 1

histogram hMWshare, barwidth(.03) percent bin(40) bcolor(ltblue) kdensity graphregion(color(white)) /// 
ytitle("(%)") xtitle(S = HH minimum wage dependency) title("S{&ge}0, all HH") saving(distrS_all,replace)
histogram hMWshare if hMWshare>0, barwidth(.03) percent bin(40) bcolor(ltkhaki) kdensity graphregion(color(white)) /// 
ytitle("(%)") xtitle(S = HH minimum wage dependency) title("S>0, minimum wage HH") saving(distrS_gr0,replace)
gr combine distrS_all.gph distrS_gr0.gph, graphregion(color(white))
graph export Figure_1.pdf, replace

